﻿
Partial Class Paginas_MenuBotones
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        'SERVICIO URGENCIA

        Medico.Attributes.Add("onclick", "parent.frames['main'].location = 'ATENCION_MEDICA.aspx';")
        Enfermera.Attributes.Add("onclick", "parent.frames['main'].location = 'ATENCION_ENFERMERA.aspx';")
        Ingreso.Attributes.Add("onclick", "parent.frames['main'].location = 'ATENCION_PREBOX.aspx';")


        'NEONATOLOGIA

        neo_ingreso.Attributes.Add("onclick", "parent.frames['main'].location = 'NEO_RESUMEN_DE_INGRESO.aspx';")
        neo_epi_gral.Attributes.Add("onclick", "parent.frames['main'].location = 'NEO_EPICRISIS_GENERAL.aspx';")
        neo_epi_prem.Attributes.Add("onclick", "parent.frames['main'].location = 'NEO_EPICRISIS_PREMATUROS.aspx';")
        neo_ficha.Attributes.Add("onclick", "parent.frames['main'].location = 'NEO_INFORME_CLINICO.aspx';")


        ' MEDICO QUIRURGICO

        Ing_Medico.Attributes.Add("onclick", "parent.frames['main'].location = 'QUIRU_INGRESO_MEDICO.aspx';")
        Ind_Medicas.Attributes.Add("onclick", "parent.frames['main'].location = 'QUIRU_INDICA_MEDICAS_CONSULTA.aspx';")
        Evol_Clinica.Attributes.Add("onclick", "parent.frames['main'].location = 'QUIRU_EVOLUCION_MEDICAS_CONSULTA.aspx';")
        EPICRISIS.Attributes.Add("onclick", "parent.frames['main'].location = 'QUIRU_EPICRISIS.aspx';")
        FICHA_CLINICA.Attributes.Add("onclick", "parent.frames['main'].location = 'Quiru_InformeClinico.aspx';")


        ' DIABETES AMBULATORIO

        DIAB_Resumen.Attributes.Add("onclick", "parent.frames['main'].location = 'DIAB_Resumen.aspx';")
        DIAB_Examen_actual.Attributes.Add("onclick", "parent.frames['main'].location = 'DIAB_Examen_actual.aspx';")
        DIAB_Insulina.Attributes.Add("onclick", "parent.frames['main'].location = 'DIAB_Insulina.aspx';")
        DIAB_eval_inicial.Attributes.Add("onclick", "parent.frames['main'].location = 'DIAB_eval_inicial.aspx';")
        DIAB_res_examenes.Attributes.Add("onclick", "parent.frames['main'].location = 'DIAB_res_examenes.aspx';")


        ' MEDICO QUIRURGICO ENFERMERIA
        ing_Enf.Attributes.Add("onclick", "parent.frames['main'].location = 'MQE_INGRESO_MEDICO.aspx';")
        EPICRISIS_Enfermeria.Attributes.Add("onclick", "parent.frames['main'].location = 'MQE_EPICRISIS.aspx';")
        ESCALA_EV_RSGO.Attributes.Add("onclick", "parent.frames['main'].location = 'MQE_ESCALA_EVALUACION.aspx';")
        IRRIGACION_VESICAL.Attributes.Add("onclick", "parent.frames['main'].location = 'MQE_IRRIGA_VESICAL_CONSULTA.aspx';")
        CUIDADOS_ENFERMERIA.Attributes.Add("onclick", "parent.frames['main'].location = 'MQE_CUIDADOS.aspx';")

        ' ADMISION
        mdto_especial.Attributes.Add("onclick", "parent.frames['main'].location = 'ADMISION_MANDATO_ESPECIAL.aspx';")
        pagare.Attributes.Add("onclick", "parent.frames['main'].location = 'ADMISION_PAGARE.aspx';")
        mdto_cheq.Attributes.Add("onclick", "parent.frames['main'].location = 'ADMISION_MANDATO_CHEQUE.aspx';")
        mdto_isapre.Attributes.Add("onclick", "parent.frames['main'].location = 'ADMISION_MANDATO_ISAPRE.aspx';")
        ing_mater.Attributes.Add("onclick", "parent.frames['main'].location = 'ADMISION_INGRESO_MATERNIDAD.aspx';")




        If Page.IsPostBack = False Then
            Dim PaginaDest As String = ""


            Dim unidad As String = Session("unidad")

            If unidad = 1 Then
                Panel1.Visible = True
                PaginaDest = "Atencion_prebox.aspx"
            End If

            If unidad = 2 Then
                Panel2.Visible = True
                PaginaDest = "NEO_RESUMEN_DE_INGRESO.aspx"
            End If

            If unidad = 3 Then
                Panel3.Visible = True
                PaginaDest = "QUIRU_INGRESO_MEDICO.aspx"
            End If

            If unidad = 4 Then
                Panel4.Visible = True
                PaginaDest = "DIAB_Resumen.aspx"
            End If

            If unidad = 5 Then
                Panel5.Visible = True
                PaginaDest = "MQE_INGRESO_MEDICO.aspx"
            End If

            If unidad = 6 Then
                Panel6.Visible = True
                PaginaDest = "ADMISION_MANDATO_ESPECIAL.aspx"
            End If

            If Session("ncodigo_pki") = "" Then
                lee_CliniWin()
            End If

            Dim destino As String
            destino = "parent.main.location.href  = '" & PaginaDest & "';"
            Dim scriptblock1 As String = "<script language='javascript'>" & destino & "</script>"
            Page.RegisterStartupScript("Launch_Report_Window", scriptblock1)
        End If

    End Sub


    Protected Sub cierre_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cierre.Click
        Dim resultado As New DataSet
        Dim Rutinas As New DataServices.Rutinas
        Dim strscript As String
        Dim csql As String


        csql = "update ATENCION_PREBOX set ccerrado=1 where ncodigo_pki=" & Session("ncodigo_pki")

        Rutinas.EjecutarSql(csql)

        Dim destino As String
        destino = "alert('Atención Cerrada');"
        'destino = destino & "document.location.href='" & Session("llamador") & "';"
        Dim scriptblock1 As String = "<script language='javascript'>" & destino & "</script>"
        Page.RegisterStartupScript("Launch_Report_Window", scriptblock1)

        Try
        Catch ex As Exception
        End Try

    End Sub

    Protected Sub formular_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles formular.SelectedIndexChanged

        Dim destino_1 As String

        If formular.SelectedValue = 1 Then
            destino_1 = "parent.frames['main'].location = 'FORM_SERVICIO_URGENCIA.aspx';"
        End If
        If formular.SelectedValue = 2 Then
            destino_1 = "parent.frames['main'].location = 'FORM_INFORME_MEDICO.aspx';"
        End If
        If formular.SelectedValue = 3 Then
            destino_1 = "parent.frames['main'].location = 'FORM_DECLARACION.aspx';"
        End If
        If formular.SelectedValue = 4 Then
            destino_1 = "parent.frames['main'].location = 'FORM_ESTAB_PACIENTES.aspx';"
        End If
        If formular.SelectedValue = 5 Then
            destino_1 = "parent.frames['main'].location = 'FORM_INTERCONSULTA.aspx';"
        End If

        Dim destino As String
        'destino = "alert('Atención Cerrada');"
        destino = destino_1
        Dim scriptblock1 As String = "<script language='javascript'>" & destino & "</script>"
        Page.RegisterStartupScript("Launch_Report_Window", scriptblock1)

    End Sub


    Protected Sub neo_cierre_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles neo_cierre.Click

        Dim resultado As New DataSet
        Dim Rutinas As New DataServices.Rutinas
        Dim strscript As String
        Dim csql As String


        csql = "update neo_resumen_ingreso set ccerrado=1 where ncodigo_pki=" & Session("ncodigo_pki")

        Rutinas.EjecutarSql(csql)

        Dim destino As String
        destino = "alert('Atención Cerrada');"
        'destino = destino & "document.location.href='" & Session("llamador") & "';"
        Dim scriptblock1 As String = "<script language='javascript'>" & destino & "</script>"
        Page.RegisterStartupScript("Launch_Report_Window", scriptblock1)

        Try
        Catch ex As Exception
        End Try
    End Sub

    Protected Sub formular2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles formular2.SelectedIndexChanged
        Dim destino_1 As String

        If formular2.SelectedValue = 1 Then
            destino_1 = "parent.frames['main'].location = 'QUIRU_CONSENT_PROCEDIMIENTO.aspx';"
        End If
        'If formular2.SelectedValue = 2 Then
        '    destino_1 = "parent.frames['main'].location = '';"
        'End If
        If formular2.SelectedValue = 3 Then
            destino_1 = "parent.frames['main'].location = 'QUIRU_EVAL_PRE_ANESTESICA.aspx';"
        End If

        If formular2.SelectedValue = 4 Then
            destino_1 = "parent.frames['main'].location = 'QUIRU_CONSENT_ORINA_DRG.aspx';"
        End If

        If formular2.SelectedValue = 5 Then
            destino_1 = "parent.frames['main'].location = 'QUIRU_CONSENT_VIH.aspx';"
        End If

        Dim destino As String
        'destino = "alert('Atención Cerrada');"
        destino = destino_1
        Dim scriptblock1 As String = "<script language='javascript'>" & destino & "</script>"
        Page.RegisterStartupScript("Launch_Report_Window", scriptblock1)
    End Sub

    Protected Sub quiru_cierre_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles quiru_cierre.Click
        Dim resultado As New DataSet
        Dim Rutinas As New DataServices.Rutinas
        Dim strscript As String
        Dim csql As String


        csql = "update QUIRU_INGRESO_MEDICO set ccerrado=1 where ncodigo_pki=" & Session("ncodigo_pki")

        Rutinas.EjecutarSql(csql)

        Dim destino As String
        destino = "alert('Atención Cerrada');"
        'destino = destino & "document.location.href='" & Session("llamador") & "';"
        Dim scriptblock1 As String = "<script language='javascript'>" & destino & "</script>"
        Page.RegisterStartupScript("Launch_Report_Window", scriptblock1)

        Try
        Catch ex As Exception
        End Try
    End Sub

    Sub lee_CliniWin()

        Dim resp As Boolean
        Dim resultado As New DataTable
        Dim conexion As New FuncionesGlobal

        Dim rut As String = Replace(Replace(Session("trut"), "-", ""), ".", "")
        rut = [String].Format("{0,10}", rut)

        Try


            Dim Csql As String = rut
            'Csql = " 114775169"
            resp = conexion.Sp_ExecuteReaderCW(resultado, Csql)
            If resultado.Rows.Count <> 0 Then

                Session("edad") = IIf(IsDBNull(resultado.Rows(0).Item(7)), "", resultado.Rows(0).Item(7))
                Session("nombre_apellido") = IIf(IsDBNull(resultado.Rows(0).Item(0)), "", resultado.Rows(0).Item(0))
                Session("nombre") = IIf(IsDBNull(resultado.Rows(0).Item(1)), "", resultado.Rows(0).Item(1))
                Session("apellido") = IIf(IsDBNull(resultado.Rows(0).Item(2)), "", resultado.Rows(0).Item(2))
                Session("sexo") = IIf(IsDBNull(resultado.Rows(0).Item(8)), "", resultado.Rows(0).Item(8))
                Session("prevision") = IIf(IsDBNull(resultado.Rows(0).Item(5)), "", resultado.Rows(0).Item(5))
                Session("domicilio") = IIf(IsDBNull(resultado.Rows(0).Item(10)), "", resultado.Rows(0).Item(10))
                Session("comuna") = IIf(IsDBNull(resultado.Rows(0).Item(11)), "", resultado.Rows(0).Item(11))
                Session("fono") = IIf(IsDBNull(resultado.Rows(0).Item(14)), "", resultado.Rows(0).Item(14))

            End If
        Catch ex As Exception

        End Try
    End Sub

    Protected Sub mqh_cierre_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles mqh_cierre.Click
        Dim resultado As New DataSet
        Dim Rutinas As New DataServices.Rutinas
        Dim strscript As String
        Dim csql As String


        csql = "update QUIRU_Enfermeria_INGRESO_MEDICO set ccerrado=1 where ncodigo_pki=" & Session("ncodigo_pki")

        Rutinas.EjecutarSql(csql)

        Dim destino As String
        destino = "alert('Atención Cerrada');"
        'destino = destino & "document.location.href='" & Session("llamador") & "';"
        Dim scriptblock1 As String = "<script language='javascript'>" & destino & "</script>"
        Page.RegisterStartupScript("Launch_Report_Window", scriptblock1)

        Try
        Catch ex As Exception
        End Try
    End Sub
End Class
